<%@page import="java.util.*" errorPage="_Error.jsp" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript" src="/js/jquery.min.js"></script>
    <script type="text/javascript" src="/js/jquery.form.js"></script>
    <link rel="stylesheet" type="text/css" href="/Style/AddStyle.css"/>
</head>
<body>
<form id="addSeatId" action="/seat" method="post" class="Form">
    <input type="hidden" name="method" value="addSeat">
    <table style=" margin:50px auto;">
        <tbody>
        <tr>
            <td>车位编号：</td>
            <td><input type="text" name="seat_num" required/></td>
        </tr>
        <tr>
            <td>所属区域：</td>
            <td>
                <select name="seat_section">
                    <option>A区</option>
                    <option>B区</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>车位备注：</td>
            <td><input type="text" name="seat_tag"/></td>
        </tr>

        </tbody>

        <tfoot>
        <tr>
            <td><input type="submit" value="确定" id="btnSure"/></td>
            <td><input type="reset" value="取消" id="btnCancel"/></td>
        </tr>
        </tfoot>
    </table>
</form>


<script>
    //表单通过ajax提交数据
    $("#addSeatId").ajaxForm({
        beforeSubmit: function () {

        },
        dataType: "json", //服务器返回数据类型,转成json对象
        success: function (data) {

            console.log(data);
            if (data.code == 400) {
                //添加成功返回提示
                alert(data.msg);
            } else {
                //添加失败返回提示
                alert(data.msg)
            }
        }
    });


</script>
</body>
</html>
